package academic.emailClient.control.listeners;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import academic.emailClient.model.EmailClientModel;
import academic.emailClient.view.EmailClientViewInterface;


/**
 * class used to tell how to react to the Search button action
 * so it displays the search view that contains both the filter 
 * button and the go to search button
 */
public class SearchMessageListener implements ActionListener{
	private EmailClientViewInterface view;
	private EmailClientModel model;
	
/**
 * constructor
 * 	
 * @param view
 * @param model
 */
	
	public SearchMessageListener(EmailClientViewInterface view, EmailClientModel model) {
		super();
		this.view = view;
		this.model = model;
	}

	/**
	 * Handle Search Message Listener Action Event
	 */
	public void actionPerformed(ActionEvent e) {
		view.showSearchMessage();
		view.addGoMessageListener(new SearchingTheMessageListener(view, model));
		view.addFilterMessageListener(new FilterMsgListener(view, model));
	}

}
